package com.qyx.pmpucat.entity;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Table;
import com.mybatisflex.core.handler.Fastjson2TypeHandler;
import com.qyx.pmpucat.entity.base.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * 题目实体类
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Table("t_question")
public class Question extends BaseEntity {

    /**
     * 题目标题
     */
    @Column("title")
    private String title;


    /**
     * 区分度参数
     */
    @Column("alphj")
    private Double alphj;

    /**
     * 问题类型: 1-单选题, 2-多选题
     */
    @Column("type")
    private Integer type;

    /**
     * 问题序号
     */
    @Column("sort")
    private Integer sort;

    /**
     * 问卷ID
     */
    @Column("questionnaire_id")
    private Long questionnaireId;

    /**
     * 选项分类ID
     */
    @Column("option_category_id")
    private Long optionCategoryId;

    /**
     * 问题选项列表
     */
    @Column(value = "options", typeHandler = Fastjson2TypeHandler.class)
    private List<QuestionOption> options;

    @Column(ignore = true)
    private Long userAnswerId;

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    public static class QuestionOption {

        /**
         * 问题ID
         */
        private Long id;

        /**
         * 选项因子值//betaj
         */
        private Double betaj;

        /**
         * 选项顺序
         */
        private Integer sort;
    }
} 